<template>
  <div class="home">
    <van-overlay :show="show" duration="3" lock-scroll z-index="100">
      <div class="wrapper" @click.stop>
       
        <van-loading size="24px" vertical color="#fff">加载中...</van-loading>
      </div>
    </van-overlay>
    <!-- 搜索框 -->
    <div class="nanv">
      <div class="shos">
        <search></search>
      </div>

      <tabs :tatitles="TabTitle"></tabs>
    </div>
    <div class="routers">
      <keep-alive>
        <router-view />
      </keep-alive>
    </div>

    <Tabbar></Tabbar>
  </div>
</template>
<style lang="less" scoped>
// .home{

// }
.routers {
  // .sj();
  padding-top: 85px;
}
.nanv {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 5;
  background-color: rgb(255, 255, 255);
}
.shos {
  // border: 1px solid #000;
  margin-left: 10px;
  margin-right: 10px;
}
.wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.block {
  width: 120px;
  height: 120px;
  background-color: #fff;
}
</style>


<script>
// @ is an alias to /src
import API from "../http/API.js";

import { Loading } from "vant";
import Tabbar from "@/components/Tabbar.vue";
import search from "@/components/Search.vue";
import tabs from "@/components/Tabs.vue";
import { Overlay } from "vant";
import { Button } from "vant";
export default {
  name: "Home",
  components: {
    search,
    tabs,
    Tabbar,
    [Loading.name]: Loading,
    [Overlay.name]: Overlay,
    [Button.name]: Button,
  },
  data() {
    return {
      //  全部首页数据
      indexdata: [],
      show: true,
      TabTitle: [],
    };
  },
  watch: {
    $route(to, from) {},
  },
  created() {
    // this.$get(API.GET_HOME_INFO, {}).then((res) => {
    //   this.indexdata = res.data;
    //   // console.log(this.indexdata);
    //   this.$store.commit("indexdata", this.indexdata);
     
    // });
    this.simulation();
  },
  mounted: function () {
    //  console.log(this.indexdata)
  },

  methods: {
    // 二级路由的标签

    simulation() {
      setTimeout(() => {
        this.TabTitle.push(
          {
            title: "关注",
            to: "/home/attentions",
          },
          {
            title: "推荐",
            to: "/home/recommend",
          },
          {
            title: "热门",
            to: "/home/hot",
          }
        );
         this.show = false;
      }, 1000);
    },

    handleScroll() {
      let scrollTop = window.pageYOffset;

      this.$route.meta.Yaxis = scrollTop;

      this.$store.commit("increment", scrollTop);
    },
  },
  //
};
</script>
